gtkwindow: Shuffle gdk_toplevel_set_startup_id() calls
authorCarlos Garnacho <carlosg@gnome.org>
Tue, 3 Jan 2023 12:51:26 +0000 (13:51 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Tue, 3 Jan 2023 13:58:33 +0000 (14:58 +0100)
commite8adfa2a889cd45ee0ce0727d7eae0a61fdb7dce
tree0e229af11fe7b79a119e8a45816d5d2ad18d9eb9
parent7fab1b85adbddff7628e3e916f00677080fb9150
gtkwindow: Shuffle gdk_toplevel_set_startup_id() calls

While this used to be tangential to windows showing or requesting
focus, the xdg-activation Wayland protocol does merge both concepts
together.

But also, for a correct interaction with the compositor, the
toolkit should ideally merge the activation request resulting from
both into the same one, so that the gdk_toplevel_focus() request
replies to the startup token that started the application and
correct focus-stealing prevention/etc happens, instead making up
one just in time for the focus request.

This kind of requires doing things in the right order, a show()
request on the GtkWindow should activate any pending activation
token on the toplevel, a present() request should additionally
create a new token if there was none pending. And
xdg_activation_v1_activate() should happen once on both.

Shuffle the gdk_toplevel_set_startup_id() calls so that this
happens in the right order for Wayland, while making X11 happy
too.
gtk/gtkwindow.c